<template>
  <div>
    <indexHeader></indexHeader>
    <indexSwiper :swiperList='swiperList'></indexSwiper>
    <indexIcons :iconList='iconList'></indexIcons>
    <indexRecommend :recommendList='recommendList'></indexRecommend>
    <indexWeekend :weekendList='weekendList'></indexWeekend>
  </div>
</template>

<script>
import indexHeader from './components/header'
import indexSwiper from './components/swiper'
import indexIcons from './components/icons'
import indexRecommend from './components/recommend'
import indexWeekend from './components/weekend'
import axios from 'axios'
export default{
  name: 'index',
  components: {
    indexHeader,
    indexSwiper,
    indexIcons,
    indexRecommend,
    indexWeekend
  },
  data () {
    return {
      swiperList: [],
      iconList: [],
      recommendList: [],
      weekendList: []
    }
  },
  methods: {
    getIndexInfo () {
      axios.get('/static/json/index.json')
        .then(this.getIndexInfoSuccess)
    },
    getIndexInfoSuccess (result) {
      if (result.status !== 200) return
      const data = result.data.data
      this.swiperList = data.swiperList
      this.iconList = data.iconList
      this.recommendList = data.recommendList
      this.weekendList = data.weekendList
    }
  },
  mounted () {
    this.getIndexInfo()
  }
}
</script>

<style>
</style>
